import request from '@/utils/http.js'
const DEBUGGER = true

/**
 * 获取手机号
 */
export function getPhone(data) {
  return request.post({
    url: '/api/wx/decodePhone',
    data: data,
    header: {
      ContentType: 'application/x-www-form-urlencoded'
    }
  })
}

/**
 * 获取主题图片
 */
export function advertising(type) {
  if (DEBUGGER) {
    return new Promise((reslove, reject) => {
      const ret = '{"msg":"操作成功","code":0,"data":[{"code":"1","pathimage":"http://110.42.235.163/static/20221008/20221008102104283.jpg","pathurl":"/","status":"Y"}]}'
      reslove(JSON.parse(ret))
    })
  }
  return request.get({
    url: '/app/sysadvertising/list',
    data: {
      type: type
    }
  })
}
/**
 * 获取默认门店
 */
export function defaultMkt() {
  if (DEBUGGER) {
    return new Promise((reslove, reject) => {
      const ret = '{"msg":"操作成功","code":0,"data":{"code":"201","cname":"利川欧泰广场","muclass":"2","status":"Y","addr":"利川市清江大道94号","memo":"108.94776,30.301032","type":"M"}}'
      reslove(JSON.parse(ret))
    })
  }
  return request.post({
    url: '/app/mkt/one',
    data: {
      code: 201
    }
  })
}
/**
 * 获取门店列表
 */
export function mktList() {
  if (DEBUGGER) {
    return new Promise((reslove, reject) => {
      const ret = '{"msg":"操作成功","code":0,"data":[{"code":"201","cname":"利川欧泰广场","muclass":"2","status":"Y","addr":"利川市清江大道94号","memo":"108.94776,30.301032","type":"M"}]}'
      reslove(JSON.parse(ret))
    })
  }
  return request.post({
    url: '/app/mkt/list',
    data: {}
  })
}
/**
 * 获取券分页
 */
export function getCoupon(data) {
  if (DEBUGGER) {
    return new Promise((reslove, reject) => {
      const ret = '{"msg":"操作成功","code":0,"data":[{"code":"201","cname":"利川欧泰广场","muclass":"2","status":"Y","addr":"利川市清江大道94号","memo":"108.94776,30.301032","type":"M"}]}'
      reslove(JSON.parse(ret))
    })
  }
  return request.post({
    url: '/app/get/page',
    data: data
  })
}

/**
 * 获取积分可兑换券列表
 */
export function pointCouponRedeemPage(data) {
  if (DEBUGGER) {
    return new Promise((reslove, reject) => {
      const ret = '{"msg":"操作成功","code":0,"data":{"total":2,"pages":1,"records":[{"name":"现金券","redeemMoney":10,"saleMoney":1000,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"A","rule":"满1元用1元,全场通用券"}]}}'
      reslove(JSON.parse(ret))
    })
  }
  return request.post({
    url: '/app/point-coupon/redeem/page',
    data: data
  })
}
/**
 * 获取可领券列表
 */
export function pointCouponReceivePage(data) {
  if (DEBUGGER) {
    return new Promise((reslove, reject) => {
      const ret = '{"msg":"操作成功","code":0,"data":{"current":1,"total":11,"pages":2,"records":[{"name":"0.1元测试券","redeemMoney":0.1,"saleMoney":0.1,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"96","scheduleId":"341","type":"D","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"}]}}'
      reslove(JSON.parse(ret))
    })
  }
  return request.post({
    url: '/app/point-coupon/get/page',
    data: data
  })
}
/**
 * 获取可买券列表
 */
export function pointCouponPayPage(data) {
  if (DEBUGGER) {
    return new Promise((reslove, reject) => {
      const ret = '{"msg":"操作成功","code":0,"data":{"current":1,"total":2,"pages":1,"records":[{"name":"0.1元测试券","redeemMoney":0.1,"saleMoney":0.1,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"96","scheduleId":"341","type":"D","rule":"满1元用1元,"},{"name":"500元购物券","redeemMoney":500,"saleMoney":0,"startTime":"2021-03-16","endTime":"2021-03-31","saled":"100","scheduleId":"341","type":"C","rule":"满1元用1元,"}]}}'
      reslove(JSON.parse(ret))
    })
  }
  return request.post({
    url: '/app/point-coupon/pay/page',
    data: data
  })
}
/**
 * 获取积分商品列表
 */
export function pointGoodsPage(data) {
  if (DEBUGGER) {
    return new Promise((reslove, reject) => {
      const ret = '{"msg":"操作成功","code":0,"data":{"pages":1,"records":[{"code":"000049","name":"四川优选黄柠檬4个1条装约 80g/个 新鲜水果","integral":"3000","left":"5","money":"156","itype":"0","imagePath":"http://hy.wentsoft.com/static/20230118/20230118210441151.png"},{"code":"000049","name":"良品铺子糖水黄桃罐头300gx2罐水果郭捞零食组合","integral":"9999","left":"100","money":"156","itype":"0","imagePath":"http://hy.wentsoft.com/static/20230118/20230118210441151.png"},{"code":"000049","name":"四川优选黄柠檬4个1条装约 80g/个 新鲜水果","integral":"3000","left":"5","money":"156","itype":"0","imagePath":"http://hy.wentsoft.com/static/20230118/20230118210441151.png"},{"code":"000049","name":"良品铺子糖水黄桃罐头300gx2罐水果郭捞零食组合","integral":"9999","left":"100","money":"156","itype":"0","imagePath":"http://hy.wentsoft.com/static/20230118/20230118210441151.png"}]}}'
      reslove(JSON.parse(ret))
    })
  }
  return request.post({
    url: '/app/pointgoods/page',
    data: data
  })
}
